package com.xxk.rocket.star.core.client;

import com.alibaba.rocketmq.client.producer.MQProducer;
import com.xxk.rocket.star.core.context.AbsProcessContext;
import com.xxk.rocket.star.core.context.ProducerContext;

public abstract class AbsProcessClientProducer<DTO>
        extends AbsProcessContext<DTO>
        implements IProcessClientProducer {

  protected abstract void processProducer(DTO dto, MQProducer mqProducer) throws Throwable;

  @Override
  public void processProducerByContext(ProducerContext producerContext, MQProducer mqProducer)
          throws Throwable {
    processProducer((DTO) producerContext.getDTOOrNew(this), mqProducer);
  }

}
